{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>t1</th>\n",
       "      <th>t2</th>\n",
       "      <th>t3</th>\n",
       "      <th>t4</th>\n",
       "      <th>t5</th>\n",
       "      <th>t6</th>\n",
       "      <th>t7</th>\n",
       "      <th>t8</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0.4317</td>\n",
       "      <td>0.8656</td>\n",
       "      <td>1.3026</td>\n",
       "      <td>1.7421</td>\n",
       "      <td>2.1836</td>\n",
       "      <td>2.6275</td>\n",
       "      <td>3.0738</td>\n",
       "      <td>3.5223</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0.8330</td>\n",
       "      <td>1.4722</td>\n",
       "      <td>2.0129</td>\n",
       "      <td>2.4890</td>\n",
       "      <td>2.9199</td>\n",
       "      <td>3.3163</td>\n",
       "      <td>3.6858</td>\n",
       "      <td>4.0328</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0.9139</td>\n",
       "      <td>1.8442</td>\n",
       "      <td>2.7898</td>\n",
       "      <td>3.7514</td>\n",
       "      <td>4.7270</td>\n",
       "      <td>5.7251</td>\n",
       "      <td>6.7420</td>\n",
       "      <td>7.7752</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1.6636</td>\n",
       "      <td>2.6511</td>\n",
       "      <td>3.4318</td>\n",
       "      <td>4.0952</td>\n",
       "      <td>4.6821</td>\n",
       "      <td>5.2148</td>\n",
       "      <td>5.7056</td>\n",
       "      <td>6.1636</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0.7143</td>\n",
       "      <td>1.4350</td>\n",
       "      <td>2.1625</td>\n",
       "      <td>2.8954</td>\n",
       "      <td>3.6341</td>\n",
       "      <td>4.3774</td>\n",
       "      <td>5.1262</td>\n",
       "      <td>5.8798</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>1.6221</td>\n",
       "      <td>2.6416</td>\n",
       "      <td>3.4526</td>\n",
       "      <td>4.1463</td>\n",
       "      <td>4.7641</td>\n",
       "      <td>5.3260</td>\n",
       "      <td>5.8453</td>\n",
       "      <td>6.3300</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>0.4631</td>\n",
       "      <td>0.9288</td>\n",
       "      <td>1.3970</td>\n",
       "      <td>1.8679</td>\n",
       "      <td>2.3422</td>\n",
       "      <td>2.8189</td>\n",
       "      <td>3.2993</td>\n",
       "      <td>3.7830</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>0.7943</td>\n",
       "      <td>1.4381</td>\n",
       "      <td>1.9944</td>\n",
       "      <td>2.4919</td>\n",
       "      <td>2.9457</td>\n",
       "      <td>3.3659</td>\n",
       "      <td>3.7591</td>\n",
       "      <td>4.1293</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>0.3837</td>\n",
       "      <td>0.7685</td>\n",
       "      <td>1.1549</td>\n",
       "      <td>1.5428</td>\n",
       "      <td>1.9321</td>\n",
       "      <td>2.3227</td>\n",
       "      <td>2.7147</td>\n",
       "      <td>3.1078</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>1.4031</td>\n",
       "      <td>2.4536</td>\n",
       "      <td>3.3457</td>\n",
       "      <td>4.1264</td>\n",
       "      <td>4.8302</td>\n",
       "      <td>5.4799</td>\n",
       "      <td>6.0859</td>\n",
       "      <td>6.6528</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "       t1      t2      t3      t4      t5      t6      t7      t8\n",
       "0  0.4317  0.8656  1.3026  1.7421  2.1836  2.6275  3.0738  3.5223\n",
       "1  0.8330  1.4722  2.0129  2.4890  2.9199  3.3163  3.6858  4.0328\n",
       "2  0.9139  1.8442  2.7898  3.7514  4.7270  5.7251  6.7420  7.7752\n",
       "3  1.6636  2.6511  3.4318  4.0952  4.6821  5.2148  5.7056  6.1636\n",
       "4  0.7143  1.4350  2.1625  2.8954  3.6341  4.3774  5.1262  5.8798\n",
       "5  1.6221  2.6416  3.4526  4.1463  4.7641  5.3260  5.8453  6.3300\n",
       "6  0.4631  0.9288  1.3970  1.8679  2.3422  2.8189  3.2993  3.7830\n",
       "7  0.7943  1.4381  1.9944  2.4919  2.9457  3.3659  3.7591  4.1293\n",
       "8  0.3837  0.7685  1.1549  1.5428  1.9321  2.3227  2.7147  3.1078\n",
       "9  1.4031  2.4536  3.3457  4.1264  4.8302  5.4799  6.0859  6.6528"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "names = [\"t1\", \"t2\", \"t3\", \"t4\", \"t5\", \"t6\", \"t7\", \"t8\"]\n",
    "data = pd.read_csv('data.csv', names=names)\n",
    "data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "ename": "KeyError",
     "evalue": "1",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mKeyError\u001b[0m                                  Traceback (most recent call last)",
      "File \u001b[1;32mc:\\Users\\WuChengpei\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\pandas\\core\\indexes\\base.py:3621\u001b[0m, in \u001b[0;36mIndex.get_loc\u001b[1;34m(self, key, method, tolerance)\u001b[0m\n\u001b[0;32m   3620\u001b[0m \u001b[39mtry\u001b[39;00m:\n\u001b[1;32m-> 3621\u001b[0m     \u001b[39mreturn\u001b[39;00m \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49m_engine\u001b[39m.\u001b[39;49mget_loc(casted_key)\n\u001b[0;32m   3622\u001b[0m \u001b[39mexcept\u001b[39;00m \u001b[39mKeyError\u001b[39;00m \u001b[39mas\u001b[39;00m err:\n",
      "File \u001b[1;32mc:\\Users\\WuChengpei\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\pandas\\_libs\\index.pyx:136\u001b[0m, in \u001b[0;36mpandas._libs.index.IndexEngine.get_loc\u001b[1;34m()\u001b[0m\n",
      "File \u001b[1;32mc:\\Users\\WuChengpei\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\pandas\\_libs\\index.pyx:163\u001b[0m, in \u001b[0;36mpandas._libs.index.IndexEngine.get_loc\u001b[1;34m()\u001b[0m\n",
      "File \u001b[1;32mpandas\\_libs\\hashtable_class_helper.pxi:5198\u001b[0m, in \u001b[0;36mpandas._libs.hashtable.PyObjectHashTable.get_item\u001b[1;34m()\u001b[0m\n",
      "File \u001b[1;32mpandas\\_libs\\hashtable_class_helper.pxi:5206\u001b[0m, in \u001b[0;36mpandas._libs.hashtable.PyObjectHashTable.get_item\u001b[1;34m()\u001b[0m\n",
      "\u001b[1;31mKeyError\u001b[0m: 1",
      "\nThe above exception was the direct cause of the following exception:\n",
      "\u001b[1;31mKeyError\u001b[0m                                  Traceback (most recent call last)",
      "\u001b[1;32mc:\\Users\\WuChengpei\\Desktop\\PTA\\DataStructuresandAlgorithmAnalysisinC\\转动惯量.ipynb Cell 3\u001b[0m in \u001b[0;36m<cell line: 1>\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> <a href='vscode-notebook-cell:/c%3A/Users/WuChengpei/Desktop/PTA/DataStructuresandAlgorithmAnalysisinC/%E8%BD%AC%E5%8A%A8%E6%83%AF%E9%87%8F.ipynb#W2sZmlsZQ%3D%3D?line=0'>1</a>\u001b[0m data[\u001b[39m1\u001b[39;49m]\n",
      "File \u001b[1;32mc:\\Users\\WuChengpei\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\pandas\\core\\frame.py:3505\u001b[0m, in \u001b[0;36mDataFrame.__getitem__\u001b[1;34m(self, key)\u001b[0m\n\u001b[0;32m   3503\u001b[0m \u001b[39mif\u001b[39;00m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39mcolumns\u001b[39m.\u001b[39mnlevels \u001b[39m>\u001b[39m \u001b[39m1\u001b[39m:\n\u001b[0;32m   3504\u001b[0m     \u001b[39mreturn\u001b[39;00m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39m_getitem_multilevel(key)\n\u001b[1;32m-> 3505\u001b[0m indexer \u001b[39m=\u001b[39m \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49mcolumns\u001b[39m.\u001b[39;49mget_loc(key)\n\u001b[0;32m   3506\u001b[0m \u001b[39mif\u001b[39;00m is_integer(indexer):\n\u001b[0;32m   3507\u001b[0m     indexer \u001b[39m=\u001b[39m [indexer]\n",
      "File \u001b[1;32mc:\\Users\\WuChengpei\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\pandas\\core\\indexes\\base.py:3623\u001b[0m, in \u001b[0;36mIndex.get_loc\u001b[1;34m(self, key, method, tolerance)\u001b[0m\n\u001b[0;32m   3621\u001b[0m     \u001b[39mreturn\u001b[39;00m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39m_engine\u001b[39m.\u001b[39mget_loc(casted_key)\n\u001b[0;32m   3622\u001b[0m \u001b[39mexcept\u001b[39;00m \u001b[39mKeyError\u001b[39;00m \u001b[39mas\u001b[39;00m err:\n\u001b[1;32m-> 3623\u001b[0m     \u001b[39mraise\u001b[39;00m \u001b[39mKeyError\u001b[39;00m(key) \u001b[39mfrom\u001b[39;00m \u001b[39merr\u001b[39;00m\n\u001b[0;32m   3624\u001b[0m \u001b[39mexcept\u001b[39;00m \u001b[39mTypeError\u001b[39;00m:\n\u001b[0;32m   3625\u001b[0m     \u001b[39m# If we have a listlike key, _check_indexing_error will raise\u001b[39;00m\n\u001b[0;32m   3626\u001b[0m     \u001b[39m#  InvalidIndexError. Otherwise we fall through and re-raise\u001b[39;00m\n\u001b[0;32m   3627\u001b[0m     \u001b[39m#  the TypeError.\u001b[39;00m\n\u001b[0;32m   3628\u001b[0m     \u001b[39mself\u001b[39m\u001b[39m.\u001b[39m_check_indexing_error(key)\n",
      "\u001b[1;31mKeyError\u001b[0m: 1"
     ]
    }
   ],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3.10.5 64-bit",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.5"
  },
  "orig_nbformat": 4,
  "vscode": {
   "interpreter": {
    "hash": "71135397ed4914ee911b7bbeef2b6bb332d1bfd94be37986d0acc399a3224385"
   }
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
